<div class="article-re" id="article-re">
	<h3><span class="title-re">相关文章</span></h3>
	<div class="article-tw clearfix">
				<?php
                $post_num = 6;
                $exclude_id = $post->ID;
                $posttags = get_the_tags(); $i = 0;
                if ( $posttags ) {
	            $tags = ''; foreach ( $posttags as $tag ) $tags .= $tag->term_id . ',';
	            $args = array(
	         	'post_status' => 'publish',
	        	'tag__in' => explode(',', $tags),
	        	'post__not_in' => explode(',', $exclude_id),
	        	'ignore_sticky_posts' => 1,
	        	'orderby' => 'comment_date',
        		'posts_per_page' => $post_num
        	);
	        query_posts($args);
	        while( have_posts() ) { the_post(); ?>
			<div class="single-mode">
				<div class="single-mode-lbox"><a  href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" target="_blank" class="img-wrap"><img src="<?php echo post_thumbnail_src(); ?>?x-oss-process=image/resize,m_fill,w_100,h_102" alt="<?php the_title(); ?>"/> </a></div>
				<div class="single-mode-rbox">
					<div class="single-mode-rbox-inner">
						<div ga_event="article_title_click" class="title-box">
							<a href="<?php the_permalink(); ?>" target="_blank" class="link">
								<?php the_title(); ?>
							</a>
						</div> 
						<div class="bui-box footer-bar">
						<?php   $custom_fields = get_post_custom_keys($post->ID);if (in_array ('laiyuan_value', $custom_fields)) : $custom = get_post_custom($post->ID);	$custom_value = $custom['laiyuan_value']; ?>
						<span>来源：</span>
						<a href="/laiyuan/<?php echo get_post_meta($post->ID,'laiyuan_value',true);?>" <?php if( ztmao('ztmao_post_target')) { echo 'target="_blank"';}?>>
						<span class="author-name "><?php echo get_post_meta($post->ID,"laiyuan_value",true);?></span>
						</a>
						<?php endif;?>
						</div>
					</div>
				</div>
			</div>
		
				<?php
	     	$exclude_id .= ',' . $post->ID; $i ++;
        	} wp_reset_query();
            }
            if ( $i < $post_num ) {
	        $cats = ''; foreach ( get_the_category() as $cat ) $cats .= $cat->cat_ID . ',';
	        $args = array(
		        'category__in' => explode(',', $cats),
		        'post__not_in' => explode(',', $exclude_id),
		        'ignore_sticky_posts' => 1,
	         	'orderby' => 'comment_date',
	        	'posts_per_page' => $post_num - $i
         	);
	        query_posts($args);
	        while( have_posts() ) { the_post(); ?>
			<div class="single-mode">
				<div class="single-mode-lbox"><a  href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" target="_blank" class="img-wrap"><img src="<?php echo post_thumbnail_src(); ?>?x-oss-process=image/resize,m_fill,w_156,h_102" alt="<?php the_title(); ?>"/> </a></div>
				<div class="single-mode-rbox">
					<div class="single-mode-rbox-inner">
						<div ga_event="article_title_click" class="title-box">
							<a href="<?php the_permalink(); ?>" target="_blank" class="link">
								<?php the_title(); ?>
							</a>
						</div> 
						<div class="bui-box footer-bar">
						<?php   $custom_fields = get_post_custom_keys($post->ID);if (in_array ('laiyuan_value', $custom_fields)) : $custom = get_post_custom($post->ID);	$custom_value = $custom['laiyuan_value']; ?>
						<span>来源：</span>
						<a href="/laiyuan/<?php echo get_post_meta($post->ID,'laiyuan_value',true);?>" <?php if( ztmao('ztmao_post_target')) { echo 'target="_blank"';}?>>
						<span class="author-name "><?php echo get_post_meta($post->ID,"laiyuan_value",true);?></span>
						</a>
						<?php endif;?>
						</div>
					</div>
				</div>
			</div>
				<?php $i++;
	    } wp_reset_query();
        }
        if ( $i  == 0 )  echo '<div class="r_title">没有相关文章!</div>';
        ?>
	</div>
</div>